<script src="/javascripts/util.js" type="text/javascript"></script>
<script src="/javascripts/calendar.js" type="text/javascript"></script>
<script type="text/javascript">
    function checkDate(){
         /*
        if(document.getElementById("beginDate").value!='' && document.getElementById("endDate").value!=''){
            if (!dateCheck(document.getElementById("beginDate").value))
                alert("开始时间不合法！输入格式为yyyy-mm-dd。");
            else if(!dateCheck(document.getElementById("endDate").value))
                alert("结束时间不合法！输入格式为yyyy-mm-dd。");   
            else
                storePaper.submit();
        }
        else if(document.getElementById("beginDate").value=='' && document.getElementById("endDate").value=='')
            storePaper.submit();
        else
            alert("开始时间与结束时间必须全部输入！");
        */
        storePaper.submit();
    }
function showProductWindow(id)
{
    window.open("/product/product_info/"+id,"_blank","height=500,width=700,top=300,left=400,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no");
}
</script>
<h1>报表中心 - <span id="secondHeading">产品调配记录</span></h1>
<form id="input-form" name="storePaper" action="/query/store_move" method="post">
<div style="margin-left:70px;">
	品名规格&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="serial" maxlength="20">&nbsp;&nbsp;导针规格&nbsp;&nbsp;<input type="text" name="name" maxlength="20"><br/>
	起始时间：
        <!-- <input id="beginDate" type="text" name="from"> -->
        <script language=javascript>
        var beignDate=new dateSelector();
        beignDate.inputID='beginDate';
        beignDate.inputName='from';
        beignDate.display();
        </script>
        <br/>结束时间：        
        <!--<input id="endDate" type="text" name="to">-->
        <script language=javascript>
        var endDate=new dateSelector();
        endDate.inputID='endDate';
        endDate.inputName='to';
        endDate.display();
        </script>
        　　　　　
        <input  type="button" value="查询" class="sub" onclick="checkDate()">
</div>
</form>
<div>
<% if @flash[:notice] -%>
        <div id="notice"><%= @flash[:notice] %></div>
<% end -%>
</div>
<%if @store_transactions%>
</p>
<TABLE border="0" id="LIST_TB">
	<TR id="LIST_TB_TITLE">
	    <TD>移出仓库</TD>
	    <TD>移入仓库</TD>
	    <TD colspan="2">产品</TD>
		<TD>变动时间</TD>
		<TD>变动数量（kpcs）</TD>
		<TD>经手人</TD>
	</TR>
	<%@store_transactions.each do |item|%>
	<TR id="LIST_TB_CONTENT1">
		<TD><%=item.from.store.name%></TD>
		<TD><%=item.to.store.name%></TD>
                <TD><a href="javascript:showProductWindow(<%=item.from.product.id%>)"><%=item.from.product.serial%></a></TD>
		<TD><a href="javascript:showProductWindow(<%=item.from.product.id%>)"><%=item.from.product.name%></a></TD>
		<TD><%=item.create_date_at%></TD>
		<TD><%=item.current_count%></TD>
		<TD><%=item.employee.name%></TD>
	</TR>
	<%end%>
</TABLE>
<%end%>
<table>
        <tr>
                <td>
                        <input type="button" value="打印当前页" class="sub" onclick="openPrintWindow('LIST_TB')"/>
                        <input type="button" value="导出当前数据" class="sub" onclick="CellAreaExcel('LIST_TB')"/>
                </td>
                <td>
                        <div class="pagination">
                        <ul>
                                <li class="btn">
                                <%if @store_transaction_pages.current.previous%>
                                <%=link_to("<<上一页", { :page => @store_transaction_pages.current.previous })%>
                                <%else%>
                                <span>&lt;&lt;上一页</span>
                                <%end%>
                        </li>
                        <li><%= pagination_links(@store_transaction_pages) if @store_transaction_pages%></li>
                                <li class="btn">
                                <%if @store_transaction_pages.current.next%>
                                <%=link_to("下一页>>", { :page => @store_transaction_pages.current.next })%>
                                <%else%>
                                <span>下一页&gt;&gt;</span>
                                <%end%>
                        <li>
                        </ul>
                        </div>
                </td>
        </tr>
</table>
